{% extends 'base.html' %}
{% block title %}代办事项程序{% endblock %}


<!--导航-->
{% block content %}

  <div id="navigation" class="container">
    <nav class="navbar navbar-default nav-inverse">
      <div class="navbar-header">
        <a href="#" class="btn btn-primary btn-lg disabled" role="button">Primary link</a>
        <a href="#" class="btn btn-default btn-lg disabled" role="button" >Link</a>
        <a class="navbar-brand" href="#"><span class="glyphicon glyphicon-th-list"></span>TODO</a>
      </div>
    </nav>
  </div>

  <!--添加todo表单-->
  <div id="todo-add container">
    <form action="{{ url_for('add') }}" method="post" class="form-inline">
      <textarea rows=5 cols=50 placeholder="请输入代办事项" name="content"></textarea>
      <button type="submit" class="btn btn-success btn-lg" style="height:100px;">添加</button>
    </form>
  </div>

  <div class="divider"></div>

  <div id="todo_list">
    <table class="table table-striped">
      <th>
        <td>状态</td>
        <td>内容</td>
        <td>时间</td>
        <td>删除</td>
        <td>完成</td>
      </th>
      {% for todo in todo_list %}
        <tr>
          <td>{{ loop.index }}</td>
          {% if todo.status ==0 %}
            <td><span class="glyphicon glyphicon-asterisk btn-warning"></span></td>
          {% elif todo.status ==1 %}
            <td><span class="glyphicon glyphicon-asterisk btn-success"></span></td>
          {% endif %}
        <td>{{ todo.content }}</td>
        <td>{{ todo['create_time'] }}</td>
        <td><a href="{{ url_for('delete',_id=todo._id) }}"><span class="glyphicon glyphicon-remove"></span></a></td>
          <td><a href="{{ url_for('finish',_id=todo._id) }}"><span class="glyphicon glyphicon-ok"></span></a></td>

{#          {{ todo._id }}#}
        </tr>

      {% endfor %}
    </table>

  </div>

{% endblock %}